add ORM for Firehose objects#23
add ORM for Firehose objects#23matthieucan wants to merge 3 commits intofedora-static-analysis:masterfrom
Conversation
the ORM uses SQLAlchemy to map Firehose objects with SQL tables.
|
Hi @davidmalcolm, we discussed with @paultag about integrating the orm used in firewoes directly into firehose. |
|
Thanks for this, @matthieucan ! |
|
Thanks. Is there any automated test coverage for this? i.e. can we have, say, a tests/test_orm.py that exercises things against an in-memory sqlite db? (does this already exist within the firewoes code?) |
|
Yes, we have this in firewoes. But I need a data set, do you think the xml files in examples/ are enough or should I add those we use? |
|
Looking at firewoes, presumably you mean the xml files in: That said, the firewoes examples look like real examples, and there's merit to that, and any testing is better than no testing :) Also, is the firewoes test suite: https://github.com/Debian/firewoes/blob/master/tests/tests.py ? Perhaps we could also have tests that simply create some objects in a loop, using logic to establish properties e.g. 10 issues, of which 3 are in one file, 7 in another, and then run a query and assert that we get the right thing back? |
|
Yes I meant these xml files in firewoes/test/data, which were more intended for firewoes anyway, those in examples/ make indeed more sense. |
Adds an autoincrement integer for the primary keys, and a field 'hash' that replaces the former primary key (strings). This permits to stay generic and still use the field "hash" in firewoes.
This script adds the analysises in examples/ to an in-memory db, queries it, and ensures the returned values are correct.
|
Should I add 'sqlalchemy' in requirements.txt and make travis.yml install them? |
|
Yes please. |
|
Since I use single table inheritance for firehose.model.{SourceRpm, DebianBinary, DebianSource}, the attribute "buildarch" exists for the three classes when they are mapped, making https://github.com/fedora-static-analysis/firehose/blob/master/tests/test_model.py#L550 fail.
What do you think? |
the ORM uses SQLAlchemy to map Firehose objects with SQL tables.